import unittest

from HTMLTestRunnerCN import HTMLTestReportCN

from settings import Test_Reorter_Name, suites, Log_File_Name, Log_level

from utils.basic_utils import select_case_level, get_log_path

from loguru import logger

# from api.base import Base

if __name__ == '__main__':
    # base = Base()
    # base.login()
    log_path = get_log_path(Log_File_Name)
    logger.add(log_path, level=Log_level, rotation='5 MB')
    test = select_case_level(suites)
    suite = unittest.TestSuite()
    suite.addTests(test)
    # smoke_suite = unittest.TestLoader().discover('cases', '*flow.py')
    with open(Test_Reorter_Name, 'wb') as f:
        runner = HTMLTestReportCN(f, title='litemall测试报告')
        runner.run(suite)
